package yunwo.cn.yzstation.presenter;

import android.widget.Toast;

import java.util.List;

import yunwo.cn.yzstation.base.BasePresenter;
import yunwo.cn.yzstation.base.Yzapp;
import yunwo.cn.yzstation.bean.EndOrganbean;
import yunwo.cn.yzstation.bean.PackProductBean;
import yunwo.cn.yzstation.bean.Waybillbean;
import yunwo.cn.yzstation.config.GoodsSP;
import yunwo.cn.yzstation.api.IorderActivityModel;
import yunwo.cn.yzstation.api.IorderActivityView;
import yunwo.cn.yzstation.model.OrderActivityModel;
import yunwo.cn.yzstation.view.activity.OrderActivity;

/**
 * Created by lao on 2017/9/11.
 */

public class OrderActivityPersenter extends BasePresenter<IorderActivityView> implements IorderActivityModel {
    OrderActivity orderActivity;
    IorderActivityView iorderActivityView;
    private final OrderActivityModel mOrderActivityModel;
    private List<EndOrganbean.DataBean> mEndOrganList;

    public OrderActivityPersenter(OrderActivity orderActivity, IorderActivityView iorderActivityView) {
        this.orderActivity = orderActivity;
        this.iorderActivityView = iorderActivityView;
        mOrderActivityModel = new OrderActivityModel(orderActivity, this);
    }







    public void getWayBill() {
        mOrderActivityModel.getWayBill();
    }



    @Override
    public void getWayBillSuccess(Waybillbean.DataBean dataBean) {
        GoodsSP.getInstance().setWayBill(dataBean.getTrackingNumber());
        GoodsSP.getInstance().setGnd(dataBean.getGnd());
        GoodsSP.getInstance().getEdit().commit();


    }

    @Override
    public void getPackProductSuccess(PackProductBean.DataBean dataBean) {

        Yzapp.getInstance().getinfoSPEditor().putString("packName", dataBean.getPackName());
        Yzapp.getInstance().getinfoSPEditor().putString("productName", dataBean.getProductName());
        Yzapp.getInstance().getinfoSPEditor().commit();
        iorderActivityView.getPackProductSuccess(dataBean);
    }

    public void getPackProduct() {
        mOrderActivityModel.getPackProduct();

    }
}
